@extends('layouts.app')
@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-12 col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">添加司机</div>
                    <div class="panel-body ">
                        <form action="{{route('admin.driver.add')}}" onsubmit="ck_submit()" class="form-horizontal" method="POST" enctype="multipart/form-data"  >
                            {{csrf_field()}}
                            
                            <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">姓名</label>
                                <div class="col-md-6">
                                    <input type="text" name="name" class="form-control" value="{{old('name')}}">
                                    @if ($errors->has('name'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group{{ $errors->has('phone') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">电话</label>
                                <div class="col-md-6">
                                    <input type="text" name="phone" class="form-control"  value="{{old('phone')}}">
                                    @if ($errors->has('phone'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('phone') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group{{ $errors->has('car_no') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">车牌号</label>
                                <div class="col-md-6">
                                    <input type="text" name="car_no" class="form-control"  value="{{old('car_no')}}">
                                    @if ($errors->has('car_no'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('car_no') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group{{ $errors->has('car_type') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">车型</label>
                                <div class="col-md-6">
                                    <input type="text" name="car_type" class="form-control"  value="{{old('car_type')}}">
                                    @if ($errors->has('car_type'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('car_type') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-group{{ $errors->has('num') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">座位数</label>
                                <div class="col-md-6">
                                    <input type="text" name="num" class="form-control"  value="{{old('num')}}">
                                    @if ($errors->has('num'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('num') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            <!--
                            <div class="form-group{{ $errors->has('free') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">剩余数</label>
                                <div class="col-md-6">
                                    <input type="text" name="free" class="form-control" value="{{old('free')}}">
                                    @if ($errors->has('free'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('free') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            -->

                            <div class="form-group{{ $errors->has('line_id') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">线路</label>
                                <div class="col-md-6">
                                    <select name="line_id" class="form-control">
                                        @foreach($line_list as $line)
                                        <option value="{{$line->id}}">{{$line->title}} (票价：{{$line->price}})</option>
                                        @endforeach
                                    </select>
                                    @if ($errors->has('line_id'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('line_id') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            <!--
                            <div class="form-group{{ $errors->has('return_trip') ? ' has-error' : '' }}">
                                <label for="email" class="col-md-4 control-label">返程</label>
                                <div class="col-md-6">
                                    <input type="checkbox" name="return_trip" value="1">
                                    @if ($errors->has('return_trip'))
                                        <span class="help-block">
                                        <strong>{{ $errors->first('return_trip') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>
                            -->
                            
                            <div class="form-group">
                                <div class="col-md-8 col-md-offset-4">
                                    <button type="submit" class="btn btn-primary">
                                        提交
                                    </button>
                                    <button type="button" class="btn btn-default" onclick="history.back()">
                                        返回
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

